const orderModel =require("../model/orderModel.js")
class order{
	static async getOrderList(ctx) {
		let {
			nowPage,
			pageSize
		} = ctx.request.query
		if (!nowPage) {
			nowPage = 1
		}
		if (!pageSize) {
			pageSize = 10
		}
		let res = await orderModel.getOrder(nowPage, pageSize)
		ctx.body = {
			code: 0,
			codeInfo: "成功",
			data: res
		}
	}
	// 退款
	static async tuiKuan(ctx){
		let {orderstatus,orderremark,oid} = ctx.request.body
		let res = await orderModel.editOrder(orderstatus,orderremark,oid)
		ctx.body =  {
			code: 0,
			codeInfo: "成功",
			data: res
		}
		
	}
	
	// 核销商品
	static async heXiao(ctx){
		let {ogid,status,oid} = ctx.request.body
		console.log(ogid,status,oid,36)
		let res = await orderModel.heXiaoOrder(ogid,status,oid)
		ctx.body =  {
			code: 0,
			codeInfo: "成功",
			data: res
		}
	}
}
module.exports=order